//
//  UIImage+Ex.swift
//  aquariumstudio
//
//  Created by zj on 2022/10/13.
//  Copyright © 2022 LXF. All rights reserved.
//

import Foundation
import UIKit

extension NSString{
    /// 非 主模块的 请设置 from aclazz 参数
    public func xx_toImage(from aclazz:AnyClass? = nil,traitCollection:UITraitCollection? = nil)->UIImage{
        if let v = UIImage.init(named: self as String){
            return v;
        }
        
        
        
        if let aclazz = aclazz, let imageV = UIImage(named: self as String, in: Bundle(for: aclazz), compatibleWith: traitCollection) {
            return imageV;
        } // Replace MyBasePodClass with yours
        
        XXLoger.e("不存在图片:<" + (self as String) + ">")
        
        return UIImage.init();
    }
}
extension String{
    public func xx_toImage(from aclazz:AnyClass? = nil,traitCollection:UITraitCollection? = nil)->UIImage{
        return asNSString.xx_toImage(from: aclazz,traitCollection:traitCollection)
    }
}
